<?php

namespace app\admin\repository;

use app\admin\model\AdminUserModel;
use think\exception\DbException;

class AdminUserRepository
{
    protected $userModel;

    public function __construct(AdminUserModel $adminUser)
    {
        $this->userModel = $adminUser;
    }


    /**
     * @param $where
     * @return array|null|\PDOStatement|string|\think\Model
     * @throws DbException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getOneInfo($where)
    {

        $data = $this->userModel->where($where)->find();
        return $data;
    }

    /**
     * @param $id
     * @param $data
     * @return AdminUserModel
     */
    public function userSave($id, $data)
    {
        $data = $this->userModel->where('id', $id)->update($data);
        return $data;
    }


}